home *** CD-ROM | disk | FTP | other *** search
/ Hobby PC 28 / Hobby PC 28.iso / MicrografxMM / FlowCharter / Autosamp / ORGCHART.FRM < prev    next >
Text File  |  1997-03-04  |  26KB  |  755 lines

  1. VERSION 4.00
  2. Begin VB.Form OrgChartDlg 
  3.    Appearance      =   0  'Flat
  4.    BackColor       =   &H00C0C0C0&
  5.    BorderStyle     =   1  'Fixed Single
  6.    Caption         =   "Organization Chart DEMO"
  7.    ClientHeight    =   1815
  8.    ClientLeft      =   465
  9.    ClientTop       =   1755
  10.    ClientWidth     =   5535
  11.    FillColor       =   &H00C0C0C0&
  12.    FillStyle       =   0  'Solid
  13.    BeginProperty Font 
  14.       name            =   "MS Sans Serif"
  15.       charset         =   0
  16.       weight          =   700
  17.       size            =   8.25
  18.       underline       =   0   'False
  19.       italic          =   0   'False
  20.       strikethrough   =   0   'False
  21.    EndProperty
  22.    ForeColor       =   &H80000008&
  23.    Height          =   2220
  24.    Icon            =   "ORGCHART.frx":0000
  25.    Left            =   405
  26.    LinkTopic       =   "Form1"
  27.    MaxButton       =   0   'False
  28.    ScaleHeight     =   1815
  29.    ScaleWidth      =   5535
  30.    Top             =   1410
  31.    Width           =   5655
  32.    Begin VB.CommandButton OptionsBtn 
  33.       Appearance      =   0  'Flat
  34.       BackColor       =   &H80000005&
  35.       Caption         =   "Options..."
  36.       Height          =   375
  37.       Left            =   4080
  38.       TabIndex        =   5
  39.       Top             =   720
  40.       Width           =   1335
  41.    End
  42.    Begin VB.CommandButton CancelBtn 
  43.       Appearance      =   0  'Flat
  44.       BackColor       =   &H80000005&
  45.       Caption         =   "Cancel"
  46.       Height          =   375
  47.       Left            =   2820
  48.       TabIndex        =   4
  49.       Top             =   1320
  50.       Width           =   1335
  51.    End
  52.    Begin VB.CommandButton BrowseBtn 
  53.       Appearance      =   0  'Flat
  54.       BackColor       =   &H80000005&
  55.       Caption         =   "Browse..."
  56.       Height          =   375
  57.       Left            =   4080
  58.       TabIndex        =   3
  59.       Top             =   240
  60.       Width           =   1335
  61.    End
  62.    Begin VB.CommandButton OKBtn 
  63.       Appearance      =   0  'Flat
  64.       BackColor       =   &H80000005&
  65.       Caption         =   "OK"
  66.       Default         =   -1  'True
  67.       Enabled         =   0   'False
  68.       Height          =   375
  69.       Left            =   1320
  70.       TabIndex        =   2
  71.       Top             =   1320
  72.       Width           =   1335
  73.    End
  74.    Begin VB.TextBox OrgChartTextFileEdit 
  75.       Appearance      =   0  'Flat
  76.       BackColor       =   &H00FFFFFF&
  77.       BeginProperty Font 
  78.          name            =   "MS Sans Serif"
  79.          charset         =   0
  80.          weight          =   400
  81.          size            =   8.25
  82.          underline       =   0   'False
  83.          italic          =   0   'False
  84.          strikethrough   =   0   'False
  85.       EndProperty
  86.       Height          =   285
  87.       Left            =   120
  88.       TabIndex        =   1
  89.       Top             =   600
  90.       Width           =   3675
  91.    End
  92.    Begin MSComDlg.CommonDialog OrgChartBrowse 
  93.       Left            =   360
  94.       Top             =   1320
  95.       _Version        =   65536
  96.       _ExtentX        =   847
  97.       _ExtentY        =   847
  98.       _StockProps     =   0
  99.    End
  100.    Begin AbcflowLib.ABC ABC1 
  101.       Height          =   375
  102.       Left            =   4560
  103.       TabIndex        =   6
  104.       Top             =   1320
  105.       Width           =   495
  106.       _version        =   65536
  107.       _extentx        =   873
  108.       _extenty        =   661
  109.       _stockprops     =   1
  110.    End
  111.    Begin VB.Line Line6 
  112.       BorderColor     =   &H00808080&
  113.       X1              =   0
  114.       X2              =   5520
  115.       Y1              =   1800
  116.       Y2              =   1800
  117.    End
  118.    Begin VB.Line Line5 
  119.       BorderColor     =   &H00808080&
  120.       X1              =   5520
  121.       X2              =   5520
  122.       Y1              =   1800
  123.       Y2              =   0
  124.    End
  125.    Begin VB.Line Line4 
  126.       BorderColor     =   &H00FFFFFF&
  127.       X1              =   5520
  128.       X2              =   0
  129.       Y1              =   0
  130.       Y2              =   0
  131.    End
  132.    Begin VB.Line Line3 
  133.       BorderColor     =   &H00FFFFFF&
  134.       X1              =   0
  135.       X2              =   0
  136.       Y1              =   1800
  137.       Y2              =   0
  138.    End
  139.    Begin VB.Line Line2 
  140.       BorderColor     =   &H00FFFFFF&
  141.       X1              =   0
  142.       X2              =   5520
  143.       Y1              =   1210
  144.       Y2              =   1210
  145.    End
  146.    Begin VB.Line Line1 
  147.       BorderColor     =   &H00808080&
  148.       X1              =   0
  149.       X2              =   5520
  150.       Y1              =   1200
  151.       Y2              =   1200
  152.    End
  153.    Begin VB.Label Label1 
  154.       Appearance      =   0  'Flat
  155.       BackColor       =   &H00C0C0C0&
  156.       Caption         =   "ASCII Text File:"
  157.       ForeColor       =   &H80000008&
  158.       Height          =   255
  159.       Left            =   120
  160.       TabIndex        =   0
  161.       Top             =   360
  162.       Width           =   2055
  163.    End
  164. End
  165. Attribute VB_Name = "OrgChartDlg"
  166. Attribute VB_Creatable = False
  167. Attribute VB_Exposed = False
  168. Dim ABC As Object
  169. Dim FormatIter As Integer
  170. Dim LoopIter As Integer
  171. Dim TotalFormatIter As Integer
  172. Dim req_objs As Integer
  173.  
  174. Private Sub ABC1_AppQuitNOTIFY()
  175.     End
  176. End Sub
  177.  
  178. Private Sub BrowseBtn_Click()
  179.     OrgChartBrowse.Action = 1
  180.    ' OrgChartBrowse.Filename = OrgChartTextFileEdit.Text
  181.     OrgChartTextFileEdit.Text = LCase(OrgChartBrowse.Filename)
  182.     OrgChartBrowse.Filename = "*.txt"
  183. End Sub
  184.  
  185. Private Function CalcPercent() As Integer
  186.     CalcPercent = 100 * ((LoopIter / req_objs) / TotalFormatIter + (FormatIter - 1) / TotalFormatIter) + 1
  187.     If CalcPerent > 100 Then CalcPercent = 100
  188.     If CalcPerent < 0 Then CalcPercent = 0
  189.  
  190.     LoopIter = LoopIter + 1
  191. End Function
  192.  
  193. Private Sub CancelBtn_Click()
  194.     Unload OrgChartDlg
  195. End Sub
  196.  
  197. Private Sub Command2_Click()
  198.     OrgChartBrowse.Action = 1
  199. End Sub
  200.  
  201. Private Function DoCreateOrgChart(ByVal Filename As String) As Integer
  202.     Dim OrgItem As String
  203.    
  204.     Dim Chart As Object
  205.     Dim cur_pos As Integer
  206.     Dim len_str As Integer
  207.  
  208.     Rem Make a new chart
  209.     Set Chart = ABC.New
  210.  
  211.     Rem Set the right shape palette
  212.     Chart.CurrentShapePalette = "Standard"
  213.     Chart.CurrentShape = "Process"
  214.     ABC.ShapePaletteVisible = False
  215.  
  216.     Rem Set the Chart's internal type
  217.     Chart.Type = "PROCESS"
  218.  
  219.     Rem Turn off master items
  220.     Chart.MasterItems.Hideall
  221.  
  222.     Chart.DrawDirection = 2
  223.     Chart.DrawPositionX = 4
  224.     Chart.DrawPositionY = 1
  225.     Chart.DrawSpacingY = 0.25
  226.     Chart.CurrentLineRouting = 3
  227.  
  228.     If OrgChartOptionsDlg.TopToBottomRBtn.Value = True Or OrgChartOptionsDlg.BottomToTopRBtn = True Then
  229.         vertical = True
  230.     Else
  231.         vertical = False
  232.     End If
  233.  
  234.     If OrgChartOptionsDlg.BottomToTopRBtn.Value = True Or OrgChartOptionsDlg.RightToLeftRBtn = True Then
  235.         inverted = True
  236.     Else
  237.         inverted = False
  238.     End If
  239.  
  240.     If vertical Then
  241.         Chart.PageLayout.Orientation = 1
  242.     Else
  243.         Chart.PageLayout.Orientation = 0
  244.     End If
  245.  
  246.     Chart.NoRepaint = True
  247.  
  248.  
  249.     len_file = FileLen(Filename)
  250.     If len_file < 32767 And len_file > 0 Then
  251.  
  252.         Dim EntireFile As String
  253.         Dim test_ascCode As Integer
  254.         Dim rank As Integer
  255.         Dim index As Integer
  256.         Dim cur_obj_count As Integer
  257.         Dim num_levels As Integer
  258.  
  259.         Open Filename For Binary Access Read As #1
  260.         EntireFile = String$(len_file, " ")
  261.         Get #1, , EntireFile
  262.         Close
  263.  
  264.         Rem Set up the progess bar
  265.         ABC.PercentGauge "Organization Chart DEMO", "PASS 1 of 2: Reading & parsing file..."
  266.         DrawnCount = 0
  267.  
  268.         req_objs = GetNumLines(EntireFile) + 1
  269.  
  270.         ReDim ShapeList(req_objs) As Object
  271.         ReDim ShapeRefStack(req_objs) As Integer
  272.         ReDim RelationMap(req_objs, 3) As Integer
  273.         Const first_child = 1, next_sibling = 2, parent = 3
  274.                                                  
  275.         cur_pos = 1
  276.         index = 2
  277.         cur_obj_count = 1
  278.         ShapeRefStack(1) = 1
  279.  
  280.         Do While cur_pos < len_file + 1
  281.